package com.example.mqconsumer.consumer;

import com.example.common.message.Demo05Message;
import lombok.extern.log4j.Log4j2;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.util.List;

@Log4j2
@Component
@RabbitListener(queues = Demo05Message.QUEUE, containerFactory  = "consumerBatchContainerFactory")
public class Demo05ConsumerBatch {
    @RabbitHandler
    public void onMessage(List<Demo05Message> messages) {
        log.info("[onMessage][线程编号:{} 消息数量：{}]", Thread.currentThread().getId(), messages.size());
    }
}
